package com.aiwu.memory;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;


import org.citra.citra_emu.R;

/**
 * 搜索类型
 */
public class SearchTypeDialog extends AlertDialog implements View.OnClickListener {

    public SearchTypeDialog(Context context) {
        super(context, R.style.AiWuDialog);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        init();
    }

    private void init() {
        setContentView(R.layout.dialog_search_type);
        setCancelable(true);
        setCanceledOnTouchOutside(true);
        findViewById(R.id.layout_type_normal).setOnClickListener(this);
        findViewById(R.id.layout_type_fuzzy).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.layout_type_normal:
                MemoryManager.getInstance().changeSearchType(MemoryManager.SEARCH_TYPE_NORMAL);
                break;
            case R.id.layout_type_fuzzy:
                MemoryManager.getInstance().changeSearchType(MemoryManager.SEARCH_TYPE_FUZZY);
                break;
        }
        dismiss();
    }
}
